<%--
  Created by IntelliJ IDEA.
  User: vortex
  Date: 2020/05/05
  Time: 18:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <title>查看账号信息</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/oksub.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/lib/loading/okLoading.js"></script>
</head>
<body>
<div class="ok-body">
    <form class="layui-form ok-form" lay-filter="openUser" >

        <fieldset class="layui-elem-field">
            <legend>账号详情</legend>
            <div class="layui-field-box">
                <div class="layui-form-item">
                    <label class="layui-form-label">账号</label>
                    <div class="layui-input-block">
                        <input type="text" name="account" placeholder="请输入账号" autocomplete="off" class="layui-input"
                               lay-verify="required" disabled>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-block">
                        <input type="text" name="password" placeholder="请输入密码" autocomplete="off" class="layui-input"
                               lay-verify="required" disabled>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">用户名</label>
                    <div class="layui-input-block" >
                        <input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input"
                               lay-verify="required" disabled>
                    </div>
                </div>
<%--

                <div class="layui-form-item">
                    <label class="layui-form-label" style="width:100px" >身份</label>
                    <div class="layui-input-block">
                        <input type="checkbox" name="roleId" lay-skin="switch" checked lay-text="管理员|用户" value="2" disabled>
                    </div>
                </div>
--%>
                <div class="layui-form-item">
                    <label class="layui-form-label">身份</label>
                    <div class="layui-input-block">
                        <input type="radio" name="roleId" value="1" title="用户" checked disabled>
                        <input type="radio" name="roleId" value="2" title="管理员" disabled>
                </div>
            </div>
        </fieldset>


    </form>
</div>
<script src="${pageContext.request.contextPath}/static/lib/layui/layui.js"></script>
<script type="text/javascript">

    let initData;

    function initForm(data) {
        let jsonString = JSON.stringify(data);
        console.log("Json:" + data);
        initData = JSON.parse(jsonString);
    }

    layui.use(["element","jquery", "form", "laydate", "okLayer", "okUtils"], function () {
        let form = layui.form;
        let laydate = layui.laydate;
        let okLayer = layui.okLayer;
        let okUtils = layui.okUtils;
        let $ = layui.jquery;

        okLoading.close($);

        // console.log("initData:" + initData);

        form.val("openUser",initData);

        console.log(initData.field.roleId);

        console.log($('input[name=roleId]').innerText);
        if ($('input[name=roleId]').innerText == 1){
            $('input[name=roleId]').removeAttr("checked");
        }

        form.render(null, "openUser");

    });
</script>
</body>
</html>
